
# village 表示农夫经过的村庄编号
# 返回值：返回农夫经过 village 村庄后，剩余的羊数

# sheepCount(7) = 2
# sheepCount(n) = 2 * (sheepCount(n+1) + 1) (n < 7)
# sheepCount(6) = 2 * (sheepCount(7) + 1)
# sheepCount(5) = 2 * (sheepCount(6) + 1)
# sheepCount(4) = 2 * (sheepCount(5) + 1)
# sheepCount(3) = 2 * (sheepCount(4) + 1)
# sheepCount(2) = 2 * (sheepCount(3) + 1)
# sheepCount(1) = 2 * (sheepCount(2) + 1)
# sheepCount(0) = 2 * (sheepCount(1) + 1)

def sheepCount(village):
  if village == 7:
    return 2
  else:
    return (sheepCount(village + 1) + 1) * 2

print(sheepCount(0))